/*
 *  settingsComp.h
 *
 *  Created by David Rowland on 26/10/2008.
 *  Copyright 2008 UWE. All rights reserved.
 *
 */

#ifndef _SETTINGSCOMP_H_
#define _SETTINGSCOMP_H_

#include <juce/juce.h>

/**
	This class holds the settings to be used in the main component.
*/

class SettingsComp : public Component
{
	private:
	
		Label* batSpeedLabel;
		Label* ballSpeedLabel;
		Label* volumeLabel;
		Label* pointsToWinLabel;
	
	
		TooltipWindow tooltipWindow; // Enable tooltips
		
	public:
		
		// These variables need to be public to be accessed by the parent component
	
		/**		The slider to control the speed of the bats.
				This has a range of 2-10 so the bats can not be frozen accidently.
		 */
		Slider* batSpeedSlider;
		
		/**		The slider to control the speed of the ball.
				This has a range of 2-10 so the ball can not be stopped completely.
		 */
		Slider* ballSpeedSlider;
	
		/**		The slider to control the volume of the audio.
				This has a range of 0-1 and is skewed to give a greater precision at lower values.
		 */
		Slider* volumeSlider;
		
		/**		The slider to determine the number of points needed to win a game.
		 */
		Slider* pointsToWinSlider;
	
		/**		Creates and configures the Settings Component.
		*/
		SettingsComp ()
		{
			batSpeedLabel = new Label(T("batSpeedLabel"), T("Bat Speed:"));
			addAndMakeVisible(batSpeedLabel);
			batSpeedLabel->setBounds(10, 10, 100, 20);
			
			batSpeedSlider = new Slider(T("Bat Speed"));
			addAndMakeVisible(batSpeedSlider);
			batSpeedSlider->setTextBoxStyle (Slider::NoTextBox, false, 0, 0);
			batSpeedSlider->setRange(2, 10, 0.1);
			batSpeedSlider->setValue(6);
			
			ballSpeedLabel = new Label(T("ballSpeedLabel"), T("Ball Speed:"));
			addAndMakeVisible(ballSpeedLabel);
			ballSpeedLabel->setBounds(10, 65, 100, 20);
			
			ballSpeedSlider = new Slider(T("Ball Speed"));
			addAndMakeVisible(ballSpeedSlider);
			ballSpeedSlider->setTextBoxStyle (Slider::NoTextBox, false, 0, 0);
			ballSpeedSlider->setRange(2, 10, 0.1);
			ballSpeedSlider->setValue(6);
			
			volumeLabel = new Label(T("volumeLabel"), T("Sound Volume:"));
			addAndMakeVisible(volumeLabel);
			volumeLabel->setBounds(10, 120, 100, 20);
			
			volumeSlider = new Slider(T("Ball Speed"));
			addAndMakeVisible(volumeSlider);
			volumeSlider->setTextBoxStyle (Slider::NoTextBox, false, 0, 0);
			volumeSlider->setRange(0, 1);
			volumeSlider->setSkewFactorFromMidPoint(0.25);
			volumeSlider->setValue(0.25);
			volumeSlider->setPopupDisplayEnabled(true, this);
			
			pointsToWinLabel = new Label(T("pointsToWin"), T("Points Required to Win:"));
			addAndMakeVisible(pointsToWinLabel);
			pointsToWinLabel->setBounds(10, 175, 140, 20);
			
			pointsToWinSlider = new Slider(T("Points to Win"));
			addAndMakeVisible(pointsToWinSlider);
			pointsToWinSlider->setTextBoxStyle(Slider::TextBoxLeft, false, 20, 20);
			pointsToWinSlider->setRange(1, 10, 1);
			pointsToWinSlider->setValue(3);
		}
		
		/**		Destructor.
		 */
		~SettingsComp ()
		{
			deleteAllChildren();
		}
		
		/**		This lays out the components.
				
				The size of the window that will hold the settings component is not changeable 
				so the positions do not need to be relative to the component. 
				The width's are however, for good practice. 
		*/
		void resized ()
		{
			batSpeedSlider->setBounds(10, 35, getWidth()-20, 20);
			ballSpeedSlider->setBounds(10, 90, getWidth()-20, 20);
			volumeSlider->setBounds(10, 145, getWidth()-20, 20);
			pointsToWinSlider->setBounds(getWidth()/2, 175, getWidth()/2-10, 20);
		}
		
		void paint (Graphics& g)
		{
			
		}
};

#endif//_SETTINGSCOMP_H_ 